package com.xiaoquan.gulimall.cart.config;

import com.xiaoquan.gulimall.cart.interceptor.CartInterceptor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @authro dxq
 * @date 2021年07月19日 20:48
 */
@Configuration
public class GulimallWebConfig implements WebMvcConfigurer {

    /**
     * 添加拦截器
     */
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        //  addPathPatterns("/**") 拦截哪些请求
        registry.addInterceptor(new CartInterceptor()).addPathPatterns("/**");
    }
}
